const app = require('../express');
const amdin = require('../dao/adminDao');
const bodyParser = require('body-parser')

app.post('/adminLogin', bodyParser.json(), (req, res) => {
    let account = req.body.account;
    let pwd = req.body.pwd;
    amdin.adminLogin(account, pwd, (result) => {
        if (result.length == 0) {
            res.end(JSON.stringify({
                msg: '账号或密码错误'
            }));
        }else{
            res.writeHead(200);
            res.end(JSON.stringify(result));
        }
    }, (err) => {
        res.end(JSON.stringify({
            msg: '账号或密码错误'
        }));
    })
})